export default {
  beforeMount(el, binding){
    const selectDom = document.querySelector('.select-loadmore .el-select-dropdown__wrap');
    function loadMore(){
      const isBase = this.scrollHeight - this.scrollTop <= this.clientHeight;
      if (isBase){
        binding.value && binding.value();
      }
    }
    el.dom = selectDom;
    el.event = loadMore;
    selectDom?.addEventListener('scroll', loadmore.bind(selectDom));
  },
  beforeUnmount(el){
    if (el.event){
      el.dom.removeEventListener('scroll', el.event);
      delete el.dom;
      delete el.event;
    }
  }
}